Rotating Lorenz Attractor

Charlie Veniot 23rd October 2022 at 2:58am
' Based on the QBJS program of the same name (https://boxgm.itch.io/qbjs) 
' Barely tweaked for BASIC Anywhere Machine by Charlie Veniot

Screen _NewImage(720, 480, 19) '❕ line was previously: Screen _NewImage(640, 480, 32)
Dim As Double p, s, b, h, x, y, z, i, rot
p = 28
s = 10
b = 8 / 3
h = 0.01
_display '❕ new line
Do
    Cls
    rot = rot + 0.01
    x = 0.3
    y = 0.3
    z = 0.456
    xx = x * Cos(rot) - y * Sin(rot)
    yy = x * Sin(rot) + y * Cos(rot)
            
    PSet (_Width / 2 + 35 * xx * 700 / (yy + 2500), _Height - 35 * z * 700 / (yy + 2500)), _RGB(255, 255, 0)
    For i = 0 To 14000
        x = x + h * s * (y - x)
        y = y + h * (x * (p - z) - y)
        z = z + h * (x * y - b * z)
        xx = x * Cos(rot) - y * Sin(rot)
        yy = x * Sin(rot) + y * Cos(rot)
        Line -(_Width / 2 + 35 * xx * 700 / (yy + 2500), _Height - 35 * z * 700 / (yy + 2500)), _RGB(245, 255, 0)
    Next
_display : _delay 0.0125 '❕ line was previously: _Limit 60
Loop